
export default vm => {
  const column = [
    {
      search: true,
      label: '文件名称',
      prop: 'title',
      hide: true,
      display: false,
    },
    {
      search: true,
      label: '案卷名称',
      prop: 'archivesId',
      type: 'select',
      dicUrl: '/archives/archives/list?isDic=true',
      props: {
        label: 'name',
        value: 'archivesId',
        res: 'rows'
      },
      html: true,
      // overHidden: true
      formatter: (val) => {
        if (!vm.$refs.crud.DIC.archivesId) return
        const archives = vm.$refs.crud.DIC.archivesId.find(item => item.archivesId == val.archivesId)
        if (!archives) return
        let flag = !archives || !(archives.doPerson) || !(archives.doOtherPerson)
        let isRelated = flag ? false : (archives.doOtherPerson + archives.doPerson).includes(vm.$store.state.user.nickName)
        return `<span style="color:${isRelated && '#67C23A'}">${archives.name}</span>`
      }
    },
    {
      label: '创建人',
      prop: 'createBy',
      display: false
    },
    {
      search: true,
      searchRange: true,
      label: '创建时间',
      prop: 'createTime',
      type: "datetime",
      format: 'yyyy年MM月dd日 HH时mm分ss秒',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      display: false
    },
    {
      width: 300,
      label: '文件',
      prop: 'json'
    },
    // {
    //   search: true,
    //   label: '备注',
    //   prop: 'remark',
    //   span: 24,
    //   formatter: (row) => {
    //     if (!row.remark) {
    //       const arr = vm.$refs.crud.DIC.dictId
    //       if (!arr) return
    //       const found = arr.find(item => item.dictValue == row.dictId)
    //       return found.remark
    //     } else {
    //       return row.remark
    //     }
    //   },
    //   disabled: false,
    // },
    {
      hide: true,
      display: false,
      label: '状态',
      prop: 'state',
      type: 'select',
      dicData: [{ label: '未归档', value: '0' }, { label: '已归档', value: '1' }],
      value: '0',
      // search: true,
      // slot: true
      formatter: (val, a) => {
        if (!vm.$refs.crud.DIC.archivesId) return
        const archives = vm.$refs.crud.DIC.archivesId.find(item => item.archivesId == val.archivesId)
        if (!archives) return
        return ['未归档', '已归档'][archives.state]
      }
    },
    {
      hide: true,
      display: false,
      label: '所属模块',
      prop: 'dictId',
      type: 'select',
      disabled: true,
      // search: true,
      props: {
        label: 'dictLabel',
        value: 'dictValue',
        res: 'rows'
      },
      dicUrl: `/system/dict/data/list?pageNum=1&pageSize=20&dictType=file_type&isDic=true`,
      value: vm.$route.query.dictId
    },


    // {
    //     label:'文件',
    //     prop: 'url'
    // },
    // {
    //   type: 'upload',
    //   label: '文件',
    //   prop: 'url',
    //   loadText: '文件上传中，请稍等',
    //   span: 24,
    //   dataType: 'string',
    //   // listType: 'picture-card',
    //   tip: '只能上传jpg/png文件，且不超过500kb',
    //   action: '/common/upload',
    //   width: 200,
    //   display: false
    // },
    // {
    //   hide: true,
    //   display: false,
    //   width: 300,
    //   label: '数据',
    //   prop: 'json'
    // },


  ]
  //   const objColumn = {
  //     1: column,
  //     2: column,
  //     3: column
  //   }

  return {
    stripe: true,
    headerAlign: 'left',
    align: 'left',
    border: true,
    defaultExpandAll: false,
    selection: true,
    tip: false,
    searchMenuSpan: 6,
    searchMenuPosition: 'left',
    size: 'mini',
    highlightCurrentRow: true,
    column: column,
    maxHeight: '600',
    searchSpan: 4,
    searchBtnText: '查询',
    emptyBtnText: '重置',
    delBtn: false
  }
}
